/**
 * Copyright (c) 2023-2023 Huawei Technologies Co., Ltd.  All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ADD_TIK2_TILING_DATA_H
#define ADD_TIK2_TILING_DATA_H
#ifdef TIK2_UT
#ifdef __CCE_KT_TEST__
#define __aicore__
#else
#define __aicore__[aicore]
#endif
class AddTik2TilingData{
    public:
    uint32_t blkDim;
    uint32_t totalSize;
    uint32_t splitTile;
};

inline __aicore__ int32_t align32(int32_t n){
    return ((n + 31) & ~31) / 32;
}

inline __aicore__ void InitTilingData(const __gm__ uint8_t *p_tilingdata, AddTik2TilingData *tilingdata){
#ifdef __CCE_KT_TEST__
    tilingdata->blkDim = (*(const __gm__ uint32_t *)(p_tilingdata + 0));
    tilingdata->totalSize = (*(const __gm__ uint32_t *)(p_tilingdata + 4));
    tilingdata->splitTile = (*(const __gm__ uint32_t *)(p_tilingdata + 8));
#endif

}

#define GET_TILING_DATA(tiling_data, tiling_arg)    \
    AddTik2TilingData tiling_data;                  \
    InitTilingData(tiling_arg, &tiling_data);

#endif
#endif // ADD_TIK2_TILING_DATA_H